#!/bin/bash

source "`dirname $0`/appname.inc"

cd ${WorkDir}

if [ ! -s ${PidFile} ]
then
    echo "${PidFile} not exist or is zero"
else
    kill -USR2 `cat ${PidFile}`
fi

TIME=0
while true
do
    if [  -s ${PidFile} ]
    then
        sleep 1
        let TIME=$TIME+1
        if [ $TIME -eq 10 ]
        then
            echo  "STOP ERROR"
            break
 
fi
    else
        echo "STOP OK"
        break
    fi
done

cd ${CurrDir}
